import java.util.Arrays;

public class code {
    public static void main(String[] args) {
        int[]arr = {1,2,3,4,5};
        int[] arr1 = new int[5];
        arr1 = Arrays.copyOf(arr,arr.length);
        for(int x : arr1){
            System.out.println(x);

        }
    }
    public static void reverse(int[] arr){
        int L = 0 ;
        int R = arr.length - 1;
        while(L < R){
            int temp = arr[L];
            arr[L] = arr[R];
            arr[R] = temp;
            L++;
            R--;
        }
    }
    public static void main8(String[] args) {
        int[] arr = {1,2,3,4,5};
        print(arr);

        reverse(arr);
        print(arr);
    }
    public static String mytoString(int[] arr){
      String ret = "[";
      for(int i = 0; i < arr.length; i++){
          ret += arr[i];
          if(i != arr.length - 1){
              ret += ",";
          }
      }
      ret += "]";
        return ret;
    }
    public static void main7(String[] args) {
        int[] arr = new int[] {1,2,3,4,5};
        String ret = mytoString(arr);
        System.out.println(ret);
    }
    public static void print(int[] arr){
        for(int i = 0; i < arr.length; i++){
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        for(int x : arr){
            System.out.print(x + " ");
        }
        System.out.println();
        String ret = Arrays.toString(arr);
        System.out.println(ret);
        System.out.println();
    }
    public static int[] func3(){
        return new int[]{1,2,3,4};
    }
    public static void main6(String[] args) {
        int[] r = func3();
        print(r);
    }
    public static void print1(int[] arr){
        for(int i = 0 ;i < arr.length; i++){
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        for(int x : arr){
            System.out.print(x + " ");
        }
        System.out.println();
        String ret = Arrays.toString(arr);
        System.out.println(ret);
    }
    public static void test1 (int[] arr){
        arr = new int[] {10,20,30,40,50};
    }
    public static void test2 (int[] arr){
        arr[0] = 99;
    }
    public static void main5(String[] args) {
        int[] arr = new int[]{1,2,3,4,5};
        test2(arr);
        print(arr);
    }
    public static void main4(String[] args) {
        int a = 0;
        System.out.println(a);
        int[] arr = null;
        System.out.println(arr[0]);
    }
    public static void main3(String[] args) {
        int[] arr1 = new int[3];
        arr1[0] = 10;
        arr1[1] = 20;
        arr1[2] = 30;
        int[] arr2 = new int[] {1,2,3,4,5};
        arr2[0] = 100;
        arr2[1] = 200;
        arr1 = arr2;
        arr1[2] = 300;
        arr1[3] = 400;
        arr1[4] = 500;
        for(int i = 0; i < arr2.length;i++){
            System.out.print(arr2[i] + " ");
        }
        System.out.println();
        for(int x : arr2){
            System.out.print(x + " ");
        }
        System.out.println();
        String ret = Arrays.toString(arr2);
        System.out.println(ret);
    }
    public static void main2(String[] args) {
        int arr[] = new int[]{1,2,3,4};
        for(int i = 0; i < arr.length;i++){
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        for(int x : arr){
            System.out.print(x + " ");
        }
        System.out.println();
       String ret = Arrays.toString(arr);
        System.out.println(ret);
    }
    public static void main1(String[] args) {
      int[] arr = {1,2,3,4};
      int[] arr1 = new int[] {1,2,3,4};
      int[] arr2 = new int[5];
    }
}
